package com.cn.esermis.server;


import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;
import java.util.concurrent.atomic.AtomicInteger;

/**
 * 消息接收侦听器
 */
@Component
public class Receiver{

    @Autowired
    private SendAndStorageProcess sendAndStorageProcess;

    private AtomicInteger counter = new AtomicInteger();    //消息计数器

    /**
     * 接收系统消息，开启异步监听
     * @param message
     */
    @Async
    public void systemMessage(Object message){
//        int counter = this.counter.incrementAndGet();
//        System.out.println("接收到第" + counter + "条消息！！频道为：server，消息内容为======：");
//
//        //TODO 开启多线程调用并处理消息
//        JSONObject result = sendAndStorageProcess.storageMsg(message);
//        System.out.println(result);
    }

}
